// 新增用户请求
function addUser(formData) {
	return $axios({
    'url': '/user/add',
    'method': 'post',
    formData
  })
}


// 新增店主请求
function addShopkeeper(formData) {
	return $axios({
	  'url': '/shopkeeper/add',
	  'method': 'post',
	  formData
	})
}

// 新增场馆请求
// function addStadium(formData) {
// 	return $axios({
// 	  'url': '/shopkeeper/add',
// 	  'method': 'post',
// 	  formData
// 	})
// }

// 新增教室请求
function addRooms(formData) {
	return $axios({
		'url': '/room/add',
		'method': 'post',
		formData
	})
}

// 新增添加会员卡请求
function addCard(formData) {
	return $axios({
		'url': '/card/add',
		'method': 'post',
		formData
	})
}


// 新增查询所有会员卡请求
function getAllCards() {
	return $axios({
		'url': '/card/getAll',
		'method': 'get'
	})
}

function createGym(data) {
	return $axios({
		url: '/stadium/createGym',
		method: 'post',
		data
	})
}

// 新增查询所有老师请求
function getAllTeachers() {
	return $axios({
		url: '/teacher/getAll',
		method: 'get'
	})
}

// 新增添加老师请求
function addTeachers(formData) {
	return $axios({
		url: '/teacher/add',
		method: 'post',
		formData
	})
}

function getUserTagsName(type) {
	return $axios({
		url: '/tags/getAllTagsName?type=' + type,
		method: 'get'
	})
}

function getCardTemp() {
	return $axios({
		url: '/cardTemp/all',
		method: 'get'
	})
}

function getCardsTagsName() {
	return $axios({
		url: '/tags/card',
		method: 'get'
	})
}

//新增提交所有数据的函数
async function kaidian(formData) {
	return $axios({
		url: '/shopkeeper/kaidian',
		method: 'post',
		data:formData
	})
}

// function transformRequestData(rawData) {
// 	return {
// 		owner: {
// 			...rawData.owner,
// 			birthday: formatBirthday(rawData.owner.birthday), // 转换日期
// 			levels: String(rawData.owner.levels), // 数字转字符串
// 			workTime: String(rawData.owner.workTime) // 数字转字符串
// 		},
// 		space: rawData.space,
// 		room: rawData.room,
// 		cards: rawData.cards,
// 		teachers: rawData.teachers
// 	};
// }

function formatBirthday(isoString) {
	if (!isoString) return null;
	const date = new Date(isoString);
	return `${date.getFullYear()}-${padZero(date.getMonth()+1)}-${padZero(date.getDate())}`;
}

function padZero(num) {
	return num < 10 ? `0${num}` : num;
}